home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / comm / misc / CallMan11.lha / CallMan / Install < prev   
Encoding:
Text File  |  1997-07-12  |  15.5 KB  |  405 lines

  1. ; ****************************************************************************
  2. ; *                                                                          *
  3. ; *  'CallMan' Install-Script                                                *
  4. ; *  written 1997 by Alexander 'Sascha' Fichtner                             *
  5. ; *                                                                          *
  6. ; *  $VER: CallMan Installer 1.0 (01.06.97)                                  *
  7. ; *                                                                          *
  8. ; *  This installer script is freeware! :-)                                  *
  9. ; *  You may use it (or parts of it) in your own installer scripts...        *
  10. ; *                                                                          *
  11. ; *  You are NOT allowed to ask ANY monetary charge for it!                  *
  12. ; *                                                                          *
  13. ; *  Feel free to send any comments/bugreports to:                           *
  14. ; *                                                                          *
  15. ; *    fichtner@informatik.tu-muenchen.de                                    *
  16. ; *                                                                          *
  17. ; ****************************************************************************
  18.  
  19. (if (= @language "english")
  20.     (
  21.         (set #default_language 1)
  22.         (set #welcome "\n\n\nWelcome to\n\nCallMan\n\n1.0 (31.05.1997)\n\n© Copyright 1997 Alexander 'Sascha' Fichtner" )
  23.         (set #requirements "\n\nRequirements:\n\n- OS 3.1\n- MUI 3.3+\n- a modem" )
  24.         (set #installmode "Would you like to install CallMan from scratch or un-install an older version?")
  25.         (set #installmode_help "Choose 'Install' to install CallMan on your system.\n\nChoose 'Un-install', to remove an already installed version of CallMan from your system." )
  26.         (set #installmode_install "Install" )
  27.         (set #installmode_uninstall "Un-install" )
  28.         (set #default_destination "Where do you wish to install CallMan? The directory 'CallMan' will be created if it is not there." )
  29.         (set #manual "The manual (in AmigaGuide format) is available in different languages. Which version(s) would you like to install?" )
  30.         (set #rates "There are different rates files for the different countries and telephone companies. Which if these rates files would you like to install?" )
  31.         (set #catalogs "Which language catalogs would you like to install?" )
  32.         (set #catalogs_where "Where do you wish to install the language catalogs?" )
  33.         (set #catalogs_locale_full "Not enough free diskspace on LOCALE: ! Copy catalog files to PROGDIR:Catalogs instead?" )
  34.         (set #catalogs_no_locale_assign "Can't find assign LOCALE: ! Copy catalog files to PROGDIR:Catalogs instead?" )
  35.         (set #install "\n\n\n\n\nI'm starting the installation now." )
  36.         (set #not_enough_diskspace "There might be not enough diskspace available on " #dest_dir "..." )
  37.         (set #install_anyway "Install anyway..." )
  38.         (set #abort "Abort installation..." )
  39.         (set #install_abort "Aborted by user..." )
  40.         (set #uninstall_dir "Please specify the 'CallMan' directory." )
  41.         (set #really_uninstall "Do you REALLY want to uninstall CallMan?" )
  42.     )
  43. )
  44.  
  45. (if (= @language "deutsch")
  46.     (
  47.         (set #default_language 2)
  48.         (set #welcome "\n\n\nHerzlich willkommen zu\n\nCallMan\n\n1.0 (23.05.1997)\n\n© Copyright 1997 Alexander 'Sascha' Fichtner" )
  49.         (set #requirements "\n\nSystemvoraussetzungen:\n\n- OS 3.1\n- MUI 3.3+\n- ein Modem" )
  50.         (set #installmode "Wollen Sie CallMan neu installieren oder eine bereits installierte Version wieder entfernen?")
  51.         (set #installmode_help "Wählen Sie 'Installieren', um CallMan in Ihrem System neu zu installieren.\n\nWählen Sie 'Deinstallieren', um eine bereits installierte Version von CallMan so weit wie möglich wieder zu entfernen." )
  52.         (set #installmode_install "Installieren" )
  53.         (set #installmode_uninstall "Deinstallieren" )
  54.         (set #default_destination "Wo möchten Sie CallMan installieren? Falls noch nicht vorhanden, wird dort das Verzeichnis 'CallMan' angelegt." )
  55.         (set #manual "Die Anleitung (im AmigaGuide-Format) liegt in mehreren Sprachen vor. Welche Version(en) möchten Sie installieren?" )
  56.         (set #rates "Es existieren unterschiedliche Gebührendateien für die verschiedenen Länder und Telefongesellschaften. Welche der folgenden Dateien sollen installiert werden?" )
  57.         (set #catalogs "Welche Sprachkataloge möchten Sie installieren?" )
  58.         (set #catalogs_where "Wohin sollen die Sprachkataloge kopiert werden?" )
  59.         (set #catalogs_locale_full "Speicherplatz in LOCALE: reicht nicht aus! Sollen die Katalogdateien stattdessen doch nach PROGDIR:Catalogs kopiert werden?" )
  60.         (set #catalogs_no_locale_assign "Kann das Assign LOCALE: nicht finden! Sollen die Katalogdateien stattdessen doch nach PROGDIR:Catalogs kopiert werden?" )
  61.         (set #install "\n\n\n\n\nIch beginne nun mit der eigentlichen Installation." )
  62.         (set #not_enough_diskspace "Voraussichtlich nicht genug Speicher frei auf " #dest_dir "..." )
  63.         (set #install_anyway "Trotzdem installieren..." )
  64.         (set #abort "Installation abbrechen..." )
  65.         (set #install_abort "Abbruch durch Benutzer..." )
  66.         (set #uninstall_dir "Bitte wählen Sie das Verzeichnis 'CallMan' aus." )
  67.         (set #really_uninstall "Wollen Sie CallMan WIRKLICH deinstallieren?" )
  68.     )
  69. )
  70.  
  71.  
  72. ; ****************************************************************************
  73. ;  install procedure
  74. ; ****************************************************************************
  75.  
  76. (procedure p_install
  77.  
  78.     (set #cm_diskspace_main    0)
  79.     (set #cm_diskspace_catalog 0)
  80.  
  81.     (set #cm_diskspace_main (+ #cm_diskspace_main (getsize "CallMan"      )))
  82.     (set #cm_diskspace_main (+ #cm_diskspace_main (getsize "CallMan.info" )))
  83.  
  84.     ; ********************
  85.     ;  choose destination
  86.     ; ********************
  87.     (set #dest_dir
  88.         (askdir (prompt #default_destination )
  89.             (help @askdir-help)
  90.             (default @default-dest)
  91.         )
  92.     )
  93.     (set #install_dir (tackon #dest_dir "CallMan"))
  94.  
  95.     ; ***************
  96.     ;  choose guides
  97.     ; ***************
  98.     (set #cm_guides
  99.         (askoptions
  100.         (prompt #manual)
  101.         (help "")
  102.         (choices " English" " Deutsch")
  103.         (default #default_language)
  104.         )
  105.     )
  106.     (if (IN #cm_guides 0)
  107.         ( ; then
  108.             (set #cm_diskspace_main (+ #cm_diskspace_main (getsize "Docs/CallMan_E.guide"      )))
  109.             (set #cm_diskspace_main (+ #cm_diskspace_main (getsize "Docs/CallMan_E.guide.info" )))
  110.             )
  111.     )
  112.     (if (IN #cm_guides 1)
  113.         ( ; then
  114.             (set #cm_diskspace_main (+ #cm_diskspace_main (getsize "Docs/CallMan_D.guide"      )))
  115.             (set #cm_diskspace_main (+ #cm_diskspace_main (getsize "Docs/CallMan_D.guide.info" )))
  116.         )
  117.     )
  118.     (set #guides_dir (tackon #install_dir "Docs"))
  119.  
  120.     ; ********************
  121.     ;  choose rates files
  122.     ; ********************
  123.     (set #ratesfiles
  124.         (askoptions
  125.         (prompt #rates)
  126.         (help "")
  127.         (choices " Deutsche TELEKOM" )
  128.         (default -1)
  129.         )
  130.     )
  131.     (if (IN #ratesfiles 0) (set #cm_diskspace_main (+ #cm_diskspace_main (getsize "Rates/DeutscheTELEKOM.rates" ))))
  132.     (set #rates_dir (tackon #install_dir "Rates"))
  133.  
  134.     ; *****************
  135.     ;  choose catalogs
  136.     ; *****************
  137.     (set #cm_language
  138.         (askoptions
  139.         (prompt #catalogs)
  140.         (help "")
  141.         (choices " English (built-in)" " Deutsch")
  142.         (default #default_language)
  143.         )
  144.     )
  145.     (if (<> #cm_language 1)
  146.         ( ; then
  147.             (if (IN #cm_language 1) (set #cm_diskspace_catalog (+ #cm_diskspace_catalog (getsize "Catalogs/deutsch/CallMan.catalog"))))
  148.             ; ****************************
  149.             ;  choose catalog destination
  150.             ; ****************************
  151.             (set #catalog_dest
  152.                 (askchoice
  153.                 (prompt #catalogs_where)
  154.                 (help "")
  155.                 (choices "LOCALE:Catalogs" "PROGDIR:Catalogs")
  156.                 (default 1)
  157.                 )
  158.             )
  159.             (if (= #catalog_dest 0)
  160.                 (
  161.                     (set #locale_path (getassign "LOCALE"))
  162.                     (if (= #locale_path "")
  163.                         ( ; then
  164.                             (set #bool
  165.                                 (askbool
  166.                                 (prompt #catalogs_no_locale_assign )
  167.                                 (help "")
  168.                                 (default 1)
  169.                                 )
  170.                             )
  171.                             (if (= #bool 1)
  172.                                 (set #catalog_dest 1)
  173.                                 (set #catalog_dest 3)
  174.                             )
  175.                         )
  176.  
  177.                         ( ; else
  178.                             (set #free_disk_space_catalog #locale_path )
  179.                             (if (< #free_disk_space_catalog #cm_disk_space_catalog)
  180.                                 (
  181.                                     (set #bool
  182.                                         (askbool
  183.                                         (prompt #catalogs_locale_full )
  184.                                         (help "")
  185.                                         (default 1)
  186.                                         )
  187.                                     )
  188.                                     (if (= #bool 1)
  189.                                         (set #catalog_dest 1)
  190.                                         (set #catalog_dest 3)
  191.                                     )
  192.                                 )
  193.                             )
  194.                         )
  195.                     )
  196.                 )
  197.             )
  198.  
  199.             (if (= #catalog_dest 1)
  200.                 (
  201.                     (set #cm_diskspace_main (+ #cm_diskspace_main #cm_diskspace_catalog))
  202.                 )
  203.             )
  204.         )
  205.     )
  206.     (set #catalogs_dir (tackon #install_dir "Catalogs"))
  207.  
  208.     ; ***************
  209.     ;  install files
  210.     ; ***************
  211.     (message #install)
  212.     (set #install_bool 1)
  213.     (if (<> (getdevice #dest_dir) "RAM" )
  214.         ( ; then
  215.             (set #free_disk_space_main (getdiskspace #dest_dir ))
  216.             (if (< #free_disk_space_main #cm_diskspace_main)
  217.                 ( ; then
  218.                     (set #install_bool 0)
  219.                     (set #bool
  220.                         (askbool
  221.                         (prompt #not_enough_diskspace )
  222.                         (help "" )
  223.                         (default 1)
  224.                         (choices #install_anyway #abort )
  225.                         )
  226.                     )
  227.                     (if (= #bool 0) (exit #install_abort (quiet)) )
  228.                     (if (= #bool 1) (set #install_bool 1) )
  229.                 )
  230.             )
  231.         )
  232.     )
  233.     (if (= #install_bool 1)
  234.         ( ; then
  235.             (complete 0)
  236.             (makedir #install_dir (infos) )
  237.             (copylib (source "CallMan") (dest #install_dir) (infos) )
  238.             (copylib (source "Install") (dest #install_dir) (infos) )
  239.  
  240.             (complete 25)
  241.             (if (<> #cm_guides 0)
  242.                 ( ; then
  243.                     (makedir #guides_dir (infos) )
  244.                     (if (IN #cm_guides 0) (copylib (source "Docs/CallMan_E.guide") (dest #guides_dir) (infos) ))
  245.                     (if (IN #cm_guides 1) (copylib (source "Docs/CallMan_D.guide") (dest #guides_dir) (infos) ))
  246.                 )
  247.             )
  248.  
  249.             (complete 50)
  250.             (if (<> #ratesfiles 0)
  251.                 ( ; then
  252.                     (makedir #rates_dir )
  253.                     (if (IN #ratesfiles 0) (copylib (source "Rates/DeutscheTELEKOM.rates") (dest #rates_dir) (infos) ))
  254.                 )
  255.             )
  256.  
  257.             (complete 75)
  258.             (if (= #catalog_dest 0)
  259.                 ( ; then
  260.                     (if (IN #cm_language 1) (copylib (source "Catalogs/deutsch/CallMan.catalog") (dest "LOCALE:Catalogs/deutsch") ) )
  261.                 )
  262.                 ( ; else
  263.                     (makedir #catalogs_dir )
  264.                     (if (IN #cm_language 1) (copylib (source "Catalogs/deutsch/CallMan.catalog") (dest (tackon #catalogs_dir "deutsch")) ) )
  265.                 )
  266.             )
  267.  
  268.         )
  269.     )
  270.     (complete 100)
  271. )
  272.  
  273.  
  274. ; ****************************************************************************
  275. ;  deinstall procedure
  276. ; ****************************************************************************
  277.  
  278. (procedure p_uninstall
  279.  
  280.     (if (= @user-level 0) (user 1))
  281.  
  282.     ; ********************
  283.     ;  choose CallMan dir
  284.     ; ********************
  285.     (set #script_dir (pathonly @icon))
  286.     (set #uninstall_dir
  287.         (askdir (prompt #uninstall_dir )
  288.             (help @askdir-help)
  289.             (default #script_dir )
  290.         )
  291.     )
  292.  
  293.     ; ****************
  294.     ;  security check
  295.     ; ****************
  296.     (set #bool
  297.         (askbool
  298.             (prompt #really_uninstall )
  299.             (help "" )
  300.             (default 1)
  301.         )
  302.     )
  303.     (if (= #bool 0) (exit #install_abort (quiet)) )
  304.  
  305.     ; *****************
  306.     ;  delete catalogs
  307.     ; *****************
  308.     (if (exists (tackon #uninstall_dir "Catalogs"))
  309.         ( ; then
  310.             (set #catalogs_dir (tackon #uninstall_dir "Catalogs" ))
  311.             (foreach #catalogs_dir "#?"
  312.                 (
  313.                     (delete (tackon #catalogs_dir (tackon @each-name "CallMan.catalog" ) ) )
  314.                     (delete (tackon #catalogs_dir @each-name ) )
  315.                 )
  316.             )
  317.             (delete #catalogs_dir )
  318.         )
  319.         ( ; else
  320.             (set #catalogs_dir "LOCALE:Catalogs" )
  321.             (foreach #catalogs_dir "#?"
  322.                 (
  323.                     (delete (tackon #catalogs_dir (tackon @each-name "CallMan.catalog" ) ) )
  324.                 )
  325.             )
  326.         )
  327.     )
  328.  
  329.     ; ********************
  330.     ;  delete rates files
  331.     ; ********************
  332.     (set #rates_dir (tackon #uninstall_dir "Rates" ))
  333.     (delete (tackon #rates_dir "DeutscheTELEKOM.rates") )
  334.     (delete #rates_dir)
  335.  
  336.     ; ***************
  337.     ;  delete guides
  338.     ; ***************
  339.     (set #guides_dir      (tackon #uninstall_dir "Docs"      ))
  340.     (set #guides_dir.info (tackon #uninstall_dir "Docs.info" ))
  341.     (if (exists #guides_dir)
  342.         (
  343.             (foreach #guides_dir "CallMan#?.guide#?"
  344.                 (
  345.                     (delete (tackon #guides_dir @each-name) )
  346.                 )
  347.             )
  348.         )
  349.     )
  350.     (delete #guides_dir      )
  351.     (delete #guides_dir.info )
  352.  
  353.     ; ****************
  354.     ;  delete CallMan
  355.     ; ****************
  356.     (set #Install      (tackon #uninstall_dir "Install"      ))
  357.     (set #Install.info (tackon #uninstall_dir "Install.info" ))
  358.     (set #CallMan      (tackon #uninstall_dir "CallMan"      ))
  359.     (set #CallMan.info (tackon #uninstall_dir "CallMan.info" ))
  360.     (delete #Install      )
  361.     (delete #Install.info )
  362.     (delete #CallMan      )
  363.     (delete #CallMan.info )
  364.  
  365.     ; **************************
  366.     ;  remove CallMan directory
  367.     ; **************************
  368.     (delete #uninstall_dir )
  369. )
  370.  
  371.  
  372. ; ****************************************************************************
  373. ;  MAIN
  374. ; ****************************************************************************
  375.  
  376. (message #welcome)
  377. (message #requirements)
  378.  
  379. ; ************************************
  380. ;  choose mode (install or deinstall)
  381. ; ************************************
  382. (set #mode
  383.     (askchoice
  384.     (prompt #installmode )
  385.     (help #installmode_help )
  386.     (choices #installmode_install #installmode_uninstall )
  387.     (default 0)
  388.     )
  389. )
  390. (welcome)
  391.  
  392. (if (= #mode 0)
  393.     ( ; then
  394.         (p_install)
  395.     )
  396. )
  397.  
  398. (if (= #mode 1)
  399.     ( ; then
  400.         (p_uninstall)
  401.     )
  402. )
  403.  
  404.  
  405.